<?php 
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../DAO/OptionsDAO.php';
class OptionsService
{
	public function create(BaseContext $context, ServiceResult $result, OptionsDomain $optionsDomain)
	{
		try
		{
			$optionsDAO = new OptionsDAO($context);
			$optionsDAO->create($optionsDomain);
			$result->setSuccess();
		}
		catch (Exception $e)
		{
			$context->logException($e);
			$result->setException($e);
		}
	}

	public function update(BaseContext $context, ServiceResult $result, OptionsDomain $optionsDomain)
	{
		try
		{
			$optionsDAO = new OptionsDAO($context);
			$optionsDAO->update($optionsDomain);
			$result->setSuccess();
		}
		catch (Exception $e)
		{
			$context->logException($e);
			$result->setException($e);
		}
	}

	public function delete(BaseContext $context, ServiceResult $result, $oid)
	{
		try
		{
			$optionsDAO = new OptionsDAO($context);
			$optionsDAO->delete($oid);
			$result->setSuccess();
		}
		catch (Exception $e)
		{
			$context->logException($e);
			$result->setException($e);
		}
	}

	public function findByOid(BaseContext $context, ServiceResult $result, $oid)
	{
		try
		{
			$optionsDAO = new OptionsDAO($context);
			$optionsDomain = $optionsDAO->findByOid($oid);
			$result->setSuccess();
			return $optionsDomain;
		}
		catch (Exception $e)
		{
			$context->logException($e);
			$result->setException($e);
		}
	}

	public function findAll(BaseContext $context, ServiceResult $result)
	{
		try
		{
			$optionsDAO = new OptionsDAO($context);
			$optionsDomainArr = $optionsDAO->findAll();
			$result->setSuccess();
			return $optionsDomainArr;
		}
		catch (Exception $e)
		{
			$context->logException($e);
			$result->setException($e);
		}
	}

}
?>